package com.broada.apm.service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import com.broada.apm.ajax.PerformanceResult;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

@Path("apm/report")
@Api(value="apm/report" , description = "报表相关的APIs")
@Produces(MediaType.APPLICATION_JSON)
public interface ReportService {

	@GET
	@Path("/system/availability")
	@ApiOperation(value = "系统可用性报表信息")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult querySystemAvailability(
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/system/fault")
	@ApiOperation(value = "系统故障报表信息")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult querySystemFault(
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/system/performance")
	@ApiOperation(value = "系统性能报表信息")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult querySystemPerformance(
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);

	@GET
	@Path("/trade/perf")
	@ApiOperation(value = "交易性能报表信息")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryTradeTypePerf(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/sort")
	@ApiOperation(value = "交易量总排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryTradeTypeSort(
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/slow")
	@ApiOperation(value = "最慢交易排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryTradeSlowSort(
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/fail")
	@ApiOperation(value = "异常交易排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryTradeFailSort(
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/http/slow")
	@ApiOperation(value = "最慢HTTP页面排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryHttpSlowSort(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/http/error")
	@ApiOperation(value = "错误HTTP页面排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryHttpErrorSort(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/sql/slow")
	@ApiOperation(value = "最慢SQL排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult querySqlSlowSort(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);

	@GET
	@Path("/sql/error")
	@ApiOperation(value = "错误SQL页面排行")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult querySqlErrorSort(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/http/slow/download")
	@ApiOperation(value = "最慢HTTP页面排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadHttpSlowSort(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/http/error/download")
	@ApiOperation(value = "错误HTTP页面排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadHttpErrorSort(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/sql/slow/download")
	@ApiOperation(value = "最慢SQL排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadSqlSlowSort(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);

	@GET
	@Path("/sql/error/download")
	@Produces(MediaType.APPLICATION_JSON)
	@ApiOperation(value = "错误SQL排行报表下载")
	public void downloadSqlErrorSort(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/system/availability/download")
	@ApiOperation(value = "系统可用性报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadSystemAvailability(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/system/fault/download")
	@ApiOperation(value = "系统故障报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadSystemFault(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/perf/download")
	@ApiOperation(value = "关键交易性能报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadTradePerf(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/sort/download")
	@ApiOperation(value = "交易量总排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadTradeSort(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/slow/download")
	@ApiOperation(value = "最慢交易排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadTradeSlow(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/trade/fail/download")
	@ApiOperation(value = "异常交易排行报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadTradeFail(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "返回查询数量", required = true) @QueryParam("top") int top, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/system/performance/download")
	@ApiOperation(value = "系统性能报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadSystemPerformance(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/yjh/trade/indicator")
	@ApiOperation(value = "银监会动态监测指标报表")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryYjhTradeIndicator(
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/yjh/download")
	@ApiOperation(value = "银监会动态监测指标报表下载")
	@Produces(MediaType.APPLICATION_JSON)
	public void downloadYjhTradeIndicator(@Context HttpServletRequest request, @Context HttpServletResponse response, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
}
